Difference updating method, program and apparatus

ABSTRACT

A difference data reception unit  32  receives difference data for all the segments and stores it in a nonvolatile memory. A restoration processing unit stores the restoration process segment number X indicative of a current process segment in the nonvolatile memory, and then restores the segment data from the difference data and stores it in the nonvolatile memory. An overwrite processing unit stores the overwrite processing segment number X- 1  indicative of an immediately preceding process segment in the nonvolatile memory, and then reads the restored data which is restored on the immediately preceding segment from the nonvolatile memory and overwrites it onto the data to be written of the volatile memory. If the power supply is interrupted during the restoration process of the segment data, a resuming processing unit resumes the restoration process from the head of the segment of the restoration process segment number which is read from the nonvolatile memory after the power supply is recovered, and if the power supply is interrupted during the overwriting process of the segment data, resumes the overwriting process from the head of the overwrite processing segment number which is read from the nonvolatile memory after the power supply is recovered.

BACKGROUND OF THE INVENTION

[0001] 1. Field of the Invention

[0002] The present invention relates generally to a difference updating method, program and apparatus for updating data of a file to be rewritten, by receiving difference data generated from two (2), old and new files, and more particularly to a difference updating method, program and apparatus for resuming a data updating process from the middle of the process after recovery of power supply interrupted during updating of the data.

[0003] 2. Description of the Related Arts

[0004] Conventionally, embedded systems such as portable terminals have limitation, such as that speed of communication with outside is low, and available work memory is small. In this environment, in order to update software stored in internal memory in a short period of time, a difference updating method utilizing old and new difference data of software is available.

[0005] When software stored in built-in memory of the embedded system is updated by the use of the difference updating method, if the amount of data to b updated is high, size of th difference data becomes large and can not be contained in available memory of the embedded system.

[0006] In this case, the entire data to be written (software) will be divided into several segments, and the updating process is executed to each one. Flow of the updating process in this case is as follows.

[0007] S1: The difference data for updating one (1) segment of the data to be written is transferred from outside and received.

[0008] S2: New one (1) segment of new data is generated from one (1) segment of the data to be written corresponding to the received one (1) segment of the difference data.

[0009] S3: The generated one (1) segment of new data is overwritten onto one segment of the data to be written.

[0010] However, in this difference updating process, when power supply to a cell phone is turned off in the middle of a process which overwrites new data generated for each segment from the difference data onto the data to be written, if it is attempted to resume the difference updating process after power supply is recovered, since the rewrite target terminal is in the state that it is rewritten partway, and data to be referenced by the difference data is lost, the updating process can not be continued.

[0011] Also, one (1) segment of new data which was generated when power supply was interrupted is lost by the power interruption, and it is not possible to reattempt overwriting of the corresponding data to be written with the resuming process according to power recovery.

[0012] Therefore, if power supply is interrupted during an overwriting process of data, it is needed to have the updated data itself transferred in order to complete the update, and if the updated data itself is received, since the amount thereof will be much larger size than the difference data, it is imperative to increase time of the updating process.

SUMMARY OF THE INVENTION

[0013] It is therefore the object of the present invention to provide a difference updating method, program and apparatus which enables a data updating process to be resumed from the middle of the process after power supply is recovered when power supply has been interrupted during the updating process for restoring new data from difference data for each transferred segment and overwriting the restored new data onto data to be written.

[0014] (Method)

[0015] In order to achieve the above object, the present invention provides a difference updating method comprising:

[0016] a difference data reception step, with a difference data reception unit, receiving difference data of all the segments which is generated for each segment by dividing a new one of two old and new files into a plurality of segments of the same size and searching for a data row matching a data row in each segment within the range from the position which is one segment before the starting position of a target segment of the old file to the endmost of the old file and storing the received difference data into a nonvolatile memory;

[0017] a restoration processing step, with a restoration processing unit, storing the restoration process segment number (X) indicative of a current process segment into the nonvolatile memory, thereafter restoring segment data from one segment of the difference data and storing the restored segment data into the nonvolatile memory; and

[0018] an overwrite processing step, with an overwrite processing unit, storing the overwrite processing segment number (X-1) indicative of an immediately preceding process segment into the nonvolatile memory, thereafter reading from the nonvolatile memory the restored data which has been restored on the immediately preceding segment and overwriting the read restored data onto data to be rewritten in a nonvolatile memory. Herein, the difference data reception step may include receiving the difference data for each segment which is generated by searching for a data row matching a data row in each segment within the range from the starting position of a target segment of the old file to the endmost of the old file.

[0019] The difference updating method of the present invention further comprises:

[0020] a decision step, with a decision unit, deciding whether the power supply is interrupted during the restoration process of the segment data or the power supply is interrupted during the overwriting process of the segment data, after the power supply is recovered in the case of power interruption;

[0021] a restoration resume step, with a restoration resume unit, resuming the restoration process from the head of the segment of the restoration process segment number read from the nonvolatile memory after the power recovery in the case where the power supply has been interrupted during the restoration process of the segment data; and

[0022] an overwriting resume step, with an overwriting resume unit, resuming the overwriting process from the head of the overwrite processing segment number read from the nonvolatile memory after the power recovery in the case where the power supply has been interrupted during the overwriting process of the segment data.

[0023] By using the difference updating method according to the invention, if power supply is interrupted during an updating process from difference data of each segment, which is included in processing procedures of the divided difference updating process on the embedded system such as a cell phone, it is possible to resume the updating procedure from that segment after power supply is recovered.

[0024] Also, at the time of power interruption during restoring data as well as at the time of power interruption during overwriting process of old data, the process before interruption will be continued after power is recovered, therefore it is possible to resume the process without executing unnecessary restoration processes and overwriting processes.

[0025] Herein, the decision step includes calculating a difference between the restoration process segment number and the overwrite processing segment number after the power supply is recovered in the case of the power interruption, deciding that the power supply was interrupted during the restoration process if the difference is 1, and deciding that the power supply was interrupted during the overwriting process if th difference is 2.

[0026] The restoration processing step includes deciding whether the content of the restored segment data which is restored from one segment of the difference data and the content of the corresponding segment data of the data to be written are identical or not, and, if these are identical, describing into the nonvolatile memory that the old and the new are identical, instead of the restored segment data. The overwrite processing step includes skipping the overwriting of the restored segment data if it is described in the nonvolatile memory that the old and the new are identical.

[0027] Consequently, if new data restored from difference data of each segment is identical to the data to be written (old data), the processing time will be reduced by making the writing of new data into the nonvolatile memory and the overwriting onto the memory which stores old data unnecessary, and by doing nothing when there is no need to execute the process.

[0028] The restoration processing step further includes equally dividing the restored segment data which is restored from one segment of the difference data into n pieces of restored block data, deciding whether the restored block data and the rewrite data are identical or not for each block, and, if these are identical, describing into the nonvolatile memory that the old and the new are identical, instead of the restored block data. The overwrite processing step includes skipping the overwriting of the restored block data if it is described in the nonvolatile memory that the old and the new are identical.

[0029] In this way, the processing time will be further reduced by dividing one (1) segment of new data restored into n blocks, by making the writing of new data into the nonvolatile memory and the overwriting onto the memory which stores old data unnecessary if it is identical to old data, and by doing nothing when there is no need to execute the process for each block unit.

[0030] In another form of the difference updating method according to the invention, a difference updating method is provided which receives and updates the difference data processed by further dividing difference data of each segment into n blocks. This difference updating method comprises:

[0031] a difference data reception step, with a difference data reception unit, generating difference data for each segment by dividing a new one of two old and new files into a plurality of segments of the same size and searching for a data row matching a data row in each segment within the range from the position which is one segment before the starting position of a target segment of the old file to the endmost of the old file, as well as equally dividing one segment of the old and new data into n blocks, deciding whether the block data of new file and the block data of old file are identical or not on a block-to-block basis, and, if these are identical, describing that the old and the new are identical into the difference data, instead of the difference block data, receiving the difference data of all the segments which has the description and storing the received difference data into a nonvolatile memory;

[0032] a restoration processing step, with a restoration processing unit, storing the restoration process segment number (X) indicative of a current process segment into the nonvolatile memory, thereafter restoring the block data which is divided into n pieces per one segment of the difference data and storing the restored block data into the nonvolatile memory; and

[0033] an overwrite processing step, with an overwrite processing unit, storing the overwrite processing segment number (X-1) indicative of an immediately preceding process segment into the nonvolatile memory, thereafter reading from the nonvolatile memory the restored block data which is divided into n pieces per restored data which is restored on the immediately preceding segment and overwriting the read restored block data onto the data to be written in the nonvolatile memory. Herein, for the difference data receiving step, it may be possible to receive difference data generated for each segment by searching for the data row matching the data row in each segment within the range from the position which is one segment before the starting position of the target segment of the old file to the endmost of the old file.

[0034] This difference updating method further comprises:

[0035] a decision step, with a decision unit, deciding whether the power supply is interrupted during the restoration process of the segment data or the power supply is interrupted during the overwriting process of the segment data, after the power supply is recovered in the case of power interruption;

[0036] a restoration resume step, with a restoration resume unit, resuming the restoration process from the head of the segment of the restoration process segment number read from the nonvolatile memory after the power recovery in the case where the power supply has been interrupted during the restoration process of the segment data; and

[0037] an overwriting resume step, with an overwriting resume unit, resuming the overwriting process from the head of th overwrite processing segment number read from the nonvolatile memory after the power recovery in the case where the power supply has been interrupted during the overwriting process of the segment data.

[0038] By using this difference updating method, if power supply is interrupted during an updating process from difference data of each segment, which is included in processing procedures of the divided difference updating process on the embedded system such as a cell phone, it is possible to resume the updating procedure from that segment after power supply is recovered.

[0039] Also, at the time of power interruption during restoring data as well as at the time of power interruption during overwriting process of old data, the process before interruption will be continued after power is recovered, therefore it is possible to resume the process without executing unnecessary restoration processes and overwriting processes.

[0040] At this point, in a deciding step, difference between a restoration process segment number and the overwrite processing segment number is calculated after power supply is recovered in the case where power supply is interrupted, and if the difference is 1, it is decided as the power interruption during the restoration process, and if the difference is 2, it is decided as the power interruption during the overwriting process.

[0041] The restoration processing step includes skipping the restoration process based on the difference block data and describing in the nonvolatile memory that the old and the new are identical, if it is described in the difference block data that the old and the new are identical. The overwrite processing step includes skipping the overwriting of the restored block data, if it is described in the nonvolatile memory that the old and the new are identical.

[0042] In this way, the processing time will be reduced by making the writing of new block data into the nonvolatile memory and the overwriting onto the memory which stores old data unnecessary if new block data which is one (1) segment restored from the difference data which is divided into n blocks is identical to old data, and further by doing nothing when there is no need to execute the process for each smaller block unit. Also, the process which divides each segment of the restored data into n blocks and compares old and new data is not needed; therefore, the processing time will be reduced correspondingly.

[0043] (Program)

[0044] In order to achieve the above object, the present invention provides a program for difference updating executed on a computer in the form of an embedded system of, e.g., a cell phone. This program allows a computer to execute:

[0045] a difference data reception step receiving difference data of all the segments which is generated for each segment by dividing a new one of two old and new files into a plurality of segments of the same size and searching for a data row matching a data row in each segment within the range from the position which is one segment before the starting position of a target segment of the old file to the endmost of the old file and storing the received difference data into a nonvolatile memory;

[0046] a restoration processing step storing the restoration process segment number (X) indicative of a current process segment into the nonvolatile memory, thereafter restoring segment data from one segment of the difference data and storing the restored segment data into the nonvolatile memory; and

[0047] an overwrite processing step storing the overwrite processing segment number (X-1) indicative of an immediately preceding process segment into the nonvolatile memory, thereafter reading from the nonvolatile memory the restored data which has been restored on the immediately preceding segment and overwriting the read restored data onto data to be rewritten in the nonvolatile memory.

[0048] This program further comprises:

[0049] a decision step deciding whether the power supply is interrupted during the restoration process of the segment data or the power supply is interrupted during the overwriting process of the segment data, after the power supply is recovered in the case of power interruption;

[0050] a restoration resume step resuming the restoration process from the head of the segment of the restoration process segment number read from the nonvolatile memory after the power recovery in the case where the power supply has been interrupted during the restoration process of the segment data; and

[0051] an overwriting resume step resuming the overwriting process from the head of the overwrite processing segment number read from the nonvolatile memory after the power recovery in the case where the power supply has been interrupted during the overwriting process of the segment data.

[0052] In another form of the program according to the invention, there is provided a program which receives and updates the difference data processed by further dividing old and new data of each segment into n blocks. This program allows a computer to execute:

[0053] a difference data reception step generating difference data for each segment by dividing a new one of two old and new files into a plurality of segments of the same size and searching for a data row matching a data row in each segment within the range from the position which is one segment before the starting position of a target segment of the old file to the endmost of the old file, as well as equally dividing one segment of the old and new data into n blocks, deciding whether the block data of new file and the block data of old file are identical or not on a block-to-block basis, and, if these are identical, describing that the old and the new are identical into the difference data, instead of the difference block data, receiving the difference data of all the segments which has the description and storing the received difference data into a nonvolatile memory;

[0054] a restoration processing step storing the restoration process segment number (X) indicative of a current process segment into the nonvolatile memory, thereafter restoring the block data which is divided into n pieces per one segment of the difference data and storing the restored block data into the nonvolatile memory; and

[0055] an overwrite processing step storing the overwrite processing segment number (X-1) indicative of an immediately preceding process segment into the nonvolatile memory, thereafter reading from the nonvolatile memory the restored block data which is divided into n pieces per restored data which is restored on the immediately preceding segment and overwriting the read restored block data onto the data to be written in the nonvolatile memory.

[0056] This program further comprises:

[0057] a decision step deciding whether the power supply is interrupted during the restoration process of the segment data or the power supply is interrupted during the overwriting process of the segment data, after the power supply is recovered in the case of power interruption;

[0058] a restoration resume step resuming the restoration process from the head of the segment of the restoration process segment number read from the nonvolatile memory after the power recovery in the case where the power supply has been interrupted during the restoration process of the segment data; and

[0059] an overwriting resume step resuming the overwriting process from the head of the overwrite processing segment number read from the nonvolatile memory after the power recovery in the case where the power supply has been interrupted during the overwriting process of the segment data.

[0060] (Apparatus)

[0061] In order to attain the above object, the present invention provides a difference updating apparatus intended for an embedded system of a cell phone, etc. The difference updating apparatus comprises:

[0062] a difference data reception unit for receiving difference data of all the segments which is generated for each segment by dividing a new one of two old and new files into a plurality of segments of the same size and searching for a data row matching a data row in each segment within the range from the position which is one segment before the starting position of a target segment of the old file to the endmost of the old file and storing the received difference data into a nonvolatile memory;

[0063] a restoration processing unit for storing the restoration process segment number (X) indicative of a current process segment into the nonvolatile memory, thereafter restoring segment data from one segment of the difference data and storing the restored segment data into the nonvolatile memory;

[0064] an overwrite processing unit for storing the overwrite processing segment number (X-1) indicative of an immediately preceding process segment into the nonvolatile memory, thereafter reading from the nonvolatile memory the restored data which has been restored on the immediately preceding segment and overwriting the read restored data onto data to be rewritten in the nonvolatile memory;

[0065] a decision unit for deciding whether the power supply is interrupted during the restoration process of the segment data or the power supply is interrupted during the overwriting process of the segment data, after the power supply is recovered in the case of power interruption;

[0066] a restoration resume unit for resuming the restoration process from the head of the segment of the restoration process segment number read from the nonvolatile memory after the power recovery in the case where the power supply has been interrupted during the restoration process of the segment data; and

[0067] an overwriting resume unit for resuming the overwriting process from the head of the overwrite processing segment number read from the nonvolatile memory after the power recovery in the case where the power supply has been interrupted during the overwriting process of the segment data.

[0068] In another form of the difference updating apparatus according to th invention, there is provided an apparatus which receives and updates the difference data processed by further dividing old and new data of each segment into n blocks.

[0069] This difference updating apparatus comprises:

[0070] a difference data reception unit for generating difference data for each segment by dividing a new one of two old and new files into a plurality of segments of the same size and searching for a data row matching a data row in each segment within the range from the position which is one segment before the starting position of a target segment of the old file to the endmost of the old file, as well as equally dividing one segment of the old and new data into n blocks, deciding whether the block data of new file and the block data of old file are identical or not on a block-to-block basis, and, if these are identical, describing that the old and the new are identical into the difference data, instead of the difference block data, receiving the difference data of all the segments which has the description and storing the received difference data into a nonvolatile memory;

[0071] a restoration processing unit for storing the restoration process segment number (X) indicative of a current process segment into the nonvolatile memory, thereafter restoring the block data which is divided into n pieces per one segment of the difference data and storing the restored block data into the nonvolatile memory;

[0072] an overwrite processing unit for storing the overwrite processing segment number (X-1) indicative of an immediately preceding process segment into the nonvolatile memory, thereafter reading from the nonvolatile memory the restored block data which is divided into n pieces per restored data which is restored on the immediately preceding segment and overwriting the read restored block data onto the data to be written in the nonvolatile memory;

[0073] a decision unit for deciding whether the power supply is interrupted during the restoration process of the segment data or the power supply is interrupted during the overwriting process of the segment data, after the power supply is recovered in the case of power interruption;

[0074] a restoration resume unit for resuming the restoration process from the head of the segment of the restoration process segment number read from the nonvolatile memory after the power recovery in the case where the power supply has been interrupted during the restoration process of the segment data; and

[0075] an overwriting resume unit for resuming the overwriting process from the head of the overwrite processing segment number read from the nonvolatile memory after the power recovery in the case where the power supply has been interrupted during the overwriting process of the segment data.

[0076] The details of the difference updating apparatus of the present invention are basically the same as those of the difference updating method.

BRIEF DESCRIPTION OF THE DRAWINGS

[0077] The above and other objects, aspects, features and advantages of the present invention will become more apparent from the following detailed description when taken in conjunction with the accompanying drawings, in which:

[0078]FIGS. 1A and 1B are block diagrams of a first embodiment according to the invention;

[0079]FIG. 2 is en explanatory diagram of a difference data generating process in the embodiment of FIGS. 1A and 1B;

[0080]FIG. 3 is en explanatory diagram of difference extraction in the case where a plurality of matching parts are present in an old file;

[0081]FIGS. 4A to 4E are explanatory diagrams of described status of the restoration process segment number and the overwrite processing segment number in the nonvolatile memory during the restoration process of the segment data;

[0082]FIGS. 5A to 5E are explanatory diagrams of described status of the restoration process segment number and the overwrite processing segment number during storing Into th nonvolatile memory after completion of restoration of the segment data;

[0083]FIG. 6A is a flowchart of the difference data generating process on the base station of FIGS. 1A and 1B;

[0084]FIG. 6B is a flowchart of the difference data generating process continued from FIG. 6A;

[0085]FIG. 7A is a flowchart of the data updating process according to the first embodiment of the invention, executed in the cell phone of FIGS. 1A and 1B;

[0086]FIG. 7B Is a flowchart of the data updating process continued from FIG. 7A;

[0087]FIGS. 8A and 8B are flowcharts of data updating process according to the first embodiment of the invention, executed after power supply interrupted during updating of data is recovered;

[0088]FIG. 8C is a flowchart of data updating process continued from FIGS. 8A and 8B;

[0089]FIGS. 9A and 9B are block diagrams of a second embodiment according to the invention;

[0090]FIG. 10A is a flowchart of the difference data generating process executed on the base station of FIGS. 9A and 9B;

[0091]FIGS. 10B and 10C are flowcharts of the difference data generating process continued from FIG. 10A;

[0092]FIG. 11A is a flowchart of the data updating process according to the second embodiment of the invention, executed in the cell phone of FIGS. 9A and 9B;

[0093]FIGS. 11B and 11C are flowcharts of the data updating process continued from FIG. 11A;

[0094]FIG. 11A is a flowchart of the data updating process according to the second embodiment of the invention, executed after power supply interrupted during updating of data is recovered;

[0095]FIGS. 12B and 12C are flowchart of the data updating process continued from FIG. 11A;

[0096]FIG. 13A is a flowchart of the data updating process according to a third embodiment of the invention, executed in the cell phone;

[0097]FIGS. 13B and 13C are flowcharts of the data updating process continued from FIG. 13A;

[0098]FIG. 14A is a flowchart of the data updating process according to the third embodiment of the invention, executed after power supply interrupted during updating of data is recovered; and

[0099]FIGS. 14B and 14C are flowcharts of the data updating process continued from FIG. 14A.

DESCRIPTION OF THE PREFERRED EMBODIMENTS

[0100]FIGS. 1A and 1B are block diagrams of a first embodiment to which the difference updating method of the invention is applied. In FIGS. 1A and 1B, within a base station 10 which functions as a difference data generating apparatus on the transmitting side, old file 14 and new file 16 is stored in a hard disk drive and the like.

[0101] In generation of difference data in the base station 10, the difference data for each segment is generated by dividing a new file 16 into a plurality of segments of constant size, for example 256 KB, and searching for a data row of the old file 14 which matches to a data row of the new file in each segment with in a range from endmost of an old file to the starting position of the target segment.

[0102] Therefore, the base station 10 is provided with a segment cut-out unit 18, a data comparison unit 20, a matching data row search unit 22, an updated data output unit 24, a duplicated code output unit 26 and a difference data output unit 28.

[0103]FIG. 2 is en explanatory diagram of a difference data generating process in the base station 10 of FIGS. 1A and 1B. The new file 16 is divided into a plurality of segments 16-1 to 16-5 which have constant size, for example 256 KB.

[0104] Assuming that a segment 16-2 is currently processed in this new file 16, a data comparison target pointer P1 is set up at a beginning address of the segment 16-2, and also for the old file 14, a data comparison reference pointer Q1 is set up at the same position, then it is checked that whether the data values, for example one (1) byte data, indicated by each pointer P1 and Q1 are matched or not.

[0105] If values are matched, measurement is conducted for how many bytes the matching data is continued for backward from this position. If the values no longer matched, “duplicated code”, which is combined with the value of the data comparison reference pointer Q1 when the values are matched for the first time and the measured matching length, is output as difference data.

[0106] On the other hand, if a value indicated by the data comparison reference pointer Q1 of the old file 14 at the same position of the data comparison target pointer P1 of the new file 16 does not match, a pointer is set up at endmost of the old file 14 like a data comparison reference pointer Q2, then the matching search for the value of data comparison target pointer P1 of the new file 16 is executed by moving the pointer forward, within the range to the segment of the old file 14 immediately preceding to the segment corresponding to the target segment 16-2.

[0107] Also, the search range in the old file 14 may be the range from endmost of the new file 16 to the segment of the old file corresponding to the target segment 16-2. The reason for extending the search range of the old file to the range to the segment immediately preceding to the target segment is that, on the difference updating side where the difference date is transferred to and received, which is disclosed in description below, overwriting of updated data to the old file is executed in the segment immediately preceding to the segment where a restoration process is executed, therefore, also on the difference data generating side, the range to the segment immediately preceding to the target segment is considered to be the search range.

[0108]FIG. 3 is the case that, for the data comparison target pointer P1 of the segment 16-2 which is the same as FIG. 2, when the matching search is executed by moving the data comparison reference pointer Q2 set on endmost of the old file 14 forward, multiple data rows 56-1, 56-2 and 56-3 are found as matches.

[0109] If multiple data rows 56-1 to 56-3 are found as matches like this, “duplicated code” which has the position of the data comparison reference pointer and the matching length of endmost data row 56-1 is output as the difference data.

[0110] On the other hand, if the matching part can not be found in the search for the matching part of the old file in FIG. 2 and FIG. 3, since the data of segment 16-2 is new updated data, “updated code” and new data is output as the difference data.

[0111] At this point, since the process which conducts the matching search for the new file 16 and the old file 14 for each segment is executed by shifting the data comparison reference pointer in increments of one (1) byte, one segment of the difference data will contain mixedly respective values, which have minimal width of one (1) byte, for the duplicated code based on the match with the old file and the updated code based on the mismatch with the old file.

[0112] More specifically describing the generation of the difference data in this way, for the base station 10 in FIGS. 1A and 1B, the segment cut-out unit 18 cuts out the updated new data in 256 KB unit from the new file 16, and in the data comparison unit 20, this is compared with the value of the starting position of the old file 14 located in corresponding position.

[0113] If the values of the segment starting position and the corresponding starting position in the old file are matched, the matching data row search unit 22 searches for the matching part of the old file as shown in FIG. 2 and FIG. 3 and outputs difference data which is “duplicated code” combined with the value of the data comparison reference pointer when the values are matched for the first time and the matching length to the difference data output unit 28.

[0114] On the other hand, if the data matched with the new data which is in the process target segment is not found in the old data, the duplicated code output unit 26 outputs the difference data which is combination of “updated code” and the new data to the difference data output unit 28.

[0115] The difference data output unit 28 receives a difference data transfer request from the embedded system such as the cell phone 12 which is connected via a transmitting line 30 and transfers the difference data for updating software stored in the sell phone. In the case of the base station 10 and the cell phone 12, this transmitting line 30 is a wireless line.

[0116] The cell phone 12 realized as the embedded system functions as the difference updating apparatus to which the difference updating method of the invention is applied. This cell phone 12 which functions as the difference updating apparatus comprises of a difference data reception unit 32, a nonvolatile memory 34, a restoration processing unit 36, a overwrite processing unit 38, a rewrite target memory 40 utilizing a nonvolatile memory and a work memory 42, as well as a resuming processing unit 44 which operates after power interruption is recovered. This resuming processing unit 44 is provided with functions of a decision unit 46, a restoration resume unit 48 and an overwriting resume unit 50.

[0117] The difference data reception unit 32 provided to the cell phone 12 requests the base station 10 to transfer the difference data of all the segments needed to update the data to be written stored in the rewrite target memory 40, receives the difference data of all the segments and stores it in the nonvolatile memory 34.

[0118] The restoration processing unit 36 stores in the nonvolatile memory 34 a restoration process segment number (X) indicating a current process segment, then restores segment data from relevant one (1) segment of the difference data and stores it in nonvolatile memory 34.

[0119] The overwrite processing unit 38 stores in the nonvolatile memory 34 an overwrite processing segment number (X-1) which indicates a process segment immediately preceding to the segment which is currently processed, then reads from the non volatile memory 34 the restoring segment data which is restored in the immediately preceding segment and overwrites it onto the data to be written in the rewrite target memory 40.

[0120] For the cell phone 12 in which the difference updating process of the Invention is executed in this way, in the updating process for each segment based on the difference data, the restoration of new data from the difference data is separated from the overwriting process onto the data to be written of restored new data, and further, if the restoration process of any segment is completed, the overwriting of new data of that segment is not executed, and the overwriting of new data restored in the immediately preceding segment is executed.

[0121] Reason for separating the restoration process and the overwriting process as well as delaying the overwriting process by one (1) segment to the restoration process is allowing for resuming the process from the point of suspension by power interruption if the power supply to the cell phone 12 is interrupted during the difference updating process, and the updating process is suspended, and after that the power supply is recovered.

[0122] Further, since the restoration process and the overwriting process is temporally separated, timing of the power interruption may be one of two cases, which the power supply is interrupted during the restoration process or the power supply is interrupted during the overwriting process, and the difference updating process will be separately resumed in the resuming processing unit 40 for each case after the power supply is recovered.

[0123] Therefore, the decision unit 46 provided to the resuming processing unit 44 decides whether the power supply is interrupted during the restoration process of the segment data or the power supply is interrupted during the overwriting process of the segment data, after the power supply is recovered in the case of power interruption. In this decision of the decision unit 46, difference between the restoration process segment number and the overwrite processing segment number is calculated after the power supply is recovered in the case of power interruption, and if the difference is 1, it is decided that the power supply is interrupted during the restoration process, and if the difference is 2, it is decided that the power supply is interrupted during the overwriting process.

[0124]FIGS. 4A to 4E are explanatory diagrams of described status of the restoration process segment number and the overwrite processing segment number in the nonvolatile memory during the restoration process of segment data in the cell phone 12 of FIGS. 1A and 1B. FIG. 4A is the restoration process segment number y, and in the restoration process using the nonvolatile memory difference data SDi of FIG. 4B, (X) is described in the nonvolatile memory 34 as the restoration process segment number y in advance of the restoration. In this status, new data NDi is restored on work memory of FIG. 4C from the difference data SDi.

[0125] At this time, the overwrite processing segment number z of FIG. 4D is only a number (x-2) described about the last but one restored data NDi-2 in the nonvolatile memory restoration data shown by FIG. 4E, and a segment number about the last restored data NDi-1 is not described yet.

[0126]FIGS. 5A to 5E are explanatory diagrams of described status of the restoration process segment number and the overwrite processing segment number during storing into the nonvolatile memory after completion of restoration of new data NDi of FIGS. 4A to 4E. FIGS. 5A to 5E are in the status that the restoration of new data NDi is completed on the work memory of FIG. 5C by means of the nonvolatile memory difference data SDi of FIG. 5B, and when the restoration is completed, restored data NDi is stored in the nonvolatile memory as shown in FIG. 5E. In advance of the storage of the restored data NDi in the nonvolatile memory, as shown in FIG. 4D, the immediately preceding segment number (X-1) is described into the nonvolatile memory as the overwrite processing segment number z.

[0127] For these each status of FIGS. 4A to 4E and FIGS. 5A to 5E, the case in which the power supply is interrupted is assumed. First, it is assumed that the power supply is interrupted during the restoration of new data NDi as shown in FIGS. 4A to 4E. In this case, the restoration process segment number y described in the nonvolatile memory is y=x, and on the other hand, the overwrite processing segment number z is z=x-2. Therefore, difference between both (y−z) is calculated as follows:

(y−z)=x−(x-2)=2.

[0128] Thus, in the case where difference between the restoration process segment number y and the overwrite processing segment number z is 2, it is known that the power interruption has occurred during the restoration process.

[0129] On the other hand, as shown in FIGS. 5A to 5E, after writing the restored new data NDi into the nonvolatile memory, the immediately preceding segment number (X-1) is described into the overwriting segment number z, then overwriting of the restored data of the immediately preceding segment onto the rewrite target memory is executed, therefore, if the power supply is interrupted during the overwriting process, the restoration process segment number y of the nonvolatile memory is y=x, and on the other hand, the overwrite processing segment number z is z=x-1. Therefore, difference between the both is calculated as follows:

(y−z)=x−(X-1)=1,

[0130] and in the case where th difference is 1, it is decided that the power supply is interrupted during the overwriting process.

[0131] Referring again to FIGS. 1A and 1B, if it is decided by the decision unit 46 that the power supply is interrupted during the restoration process of the segment data, the restoration resume unit 48 provided to the resuming processing unit 44 of the cell phone 12 resumes the restoration process from the head of the segment of the restoration process segment number which is read from the nonvolatile memory 34, after the power supply is recovered.

[0132] Also, if it is decided by the decision unit 46 that the power supply is interrupted during the overwriting process of the segment data, the overwriting resume unit 50 resumes the overwriting process from the head of the overwrite processing segment number which is read from the nonvolatile memory 34, after the power supply is recovered.

[0133] With these functions of the resuming processing unit 44, if the power supply to the cell phone 12 is interrupted during the difference updating process based on the difference data and is recovered afterward, whether the power interruption occurs during the restoration process or during the overwriting process, it is possible to resume the process from each suspended segment position and continue the difference updating process after the power supply is recovered.

[0134] Also, in the restoration processing unit 36 of the difference updating process of the invention, after restoring new data for each segment by means of the difference data, it is decided that the data is identical to the data to be written of the rewrite target memory, i.e. old data, or not, and if it is identical, an old and new identical code is written onto the nonvolatile memory, and storage of new data is skipped, and only in the case where it is not identical, the process for writing the new data onto the nonvolatile memory is executed concurrently.

[0135]FIGS. 6A and 6B are flowcharts of the difference data generating process in the base station 10 of FIGS. 1A and 1B. Here the size of one segment is assumed to be 256 KB.

[0136] S1: Read old file from a disk or the like.

[0137] S2: Read data which size is 256 KB from new file, and define as one (1) segment x (the xth segment).

[0138] S3: Set up a data comparison target pointer P at the head of the segment x, and a data reference pointer Q at the position corresponding to the head of the segment x.

[0139] S4: Compare a value indicated by the data comparison target pointer P and a value Indicated by the data reference pointer Q.

[0140] S5: If values of S4 are identical, proceed to S8, otherwise proceed to S6.

[0141] S6: Search for matching part with the value indicated by the data comparison target pointer from endmost of the old file toward the position corresponding to the head of the segment (X-1).

[0142] S7: As a result of the search, if the matching data is found in the old file, proceed to S8. If not found, proceed to S11.

[0143] S8: Move the data comparison target pointer P and the data reference pointer Q from the position of each pointer backward in increments of one (1) byte, compare values thereof, and measure how many bytes matching of the values occurs for consecutively.

[0144] S9: When the values are no longer matching, output the value of the data reference pointer when the values matched for the first time and the matching length measured in S6 as “duplicated code” into the difference data.

[0145] S10: Move the data comparison target pointer P and the data reference pointer Q to the position of the last matching data, and proceed to S13.

[0146] S11: It is decided that this is the case that the matching data is not found in the old file in S7 and the value indicated by the data comparison target is newly appear d data with the update.

[0147] S12: Output an updated code and a value thereof (updated data) into the different data.

[0148] S13: Move the data comparison target pointer P one (1) byte backward.

[0149] S14: As a result of the movement of S13, if the data comparison target pointer P reaches to endmost of the segment x, proceed to S15, otherwise proceed to S4.

[0150] S15: If the segment x is the final segment of the new file, terminate the difference extracting process, otherwise proceed to S16.

[0151] S16: In order to make next segment into the reading target, increment x by 1 and back to S2.

[0152]FIGS. 7A and 7B are flowcharts of the data updating process in the cell phone 12 of FIGS. 1A and 1B. Here the default value of x is assumed to be 1.

[0153] S1: Have the difference data for all segments transferred from outside and receive It.

[0154] S2: Store the received difference data into the-nonvolatile memory.

[0155] S3: Describe the value x into the nonvolatile memory as the restoration process segment number.

[0156] S4: Read the difference data for the segment x from the nonvolatile memory.

[0157] S5: Read one (1) code from the transferred difference data.

[0158] S6: If the code read in S5 is “duplicated code”, proceed to S7, or is “updated code”, proceed to S8.

[0159] S7: From the reference position indicated by “duplicated code”, Output data of duplicated length indicated by “duplicated code” into the work memory, and proceed to S9.

[0160] S8: Output the updated data indicated by “updated code” into the work memory.

[0161] S9: Move the code reading position in the difference data backward for one (1) position.

[0162] S10: If the code reading position in the difference data is endmost of the difference data, proceed to S11, otherwise back to S5.

[0163] S11: Compare new data of the segment x restored on the work memory with old data of the segment x on the rewrite target memory, and if these are identical, proceed to S12, otherwise proceed to S13.

[0164] S12: Write into the nonvolatile memory the old and new identical code which indicates that old and new data of the segment x is identical, and proceed to S14.

[0165] S13: Store new data of the segment x restored on the work memory into the nonvolatile memory.

[0166] S14: Describe the value (X-1) into the nonvolatile memory as the overwrite processing segment number.

[0167] S15: Read the content of the nonvolatile memory which stores data of the segment (X-1), and if the old and new identical code is described, proced to S17, otherwise proceed to S16.

[0168] S16: Overwrite new data of the segment (X-1) restored on the nonvolatile memory onto the segment (X-1) of old data stored in the internal memory.

[0169] S17: In order to make next segment into the reading target, increment x by 1.

[0170] S18: If restoration of all the segments is completed, proceed to S19, otherwise back to S3.

[0171] S19: Overwrite new data of the final segment restored on the nonvolatile memory onto the final segment of old data stored in the internal memory.

[0172] In this data updating process, by storing the difference data of all the segments into the nonvolatile memory first with the processes of step S1 and S2, a problem that the difference data can not be received from outside because of the power interruption during the updating process is resolved. Also, with the description of the restoration process segment number into the nonvolatile memory in step S3 and the description of the overwrite processing segment number into the nonvolatile memory in step S14, if the updating process is suspended by the power interruption, it will be possible to resume the updating process from the segment in the middle after the power supply is recovered.

[0173] Further, with the storage of new data of the segment restored in step S13 into the nonvolatile memory, a problem that the new data of the restored segment is lost by the power interruption is resolved. Also, with the processes of step S11 and S12, by comparing the restored new data with the old data, and if these are identical, by writing into the nonvolatile memory the old and new identical code and omitting to write the restored new data, increase of processing time with the overwriting process will be prevented.

[0174]FIGS. 8A to 8C are flowcharts of the process for resuming the updating process from the middle after the power supply is recovered, when the power supply is interrupted during the data updating process in the cell phone 12 in FIGS. 1A and 1B. This process is the one in which processes of steps S1 and S2 in FIG. 7A are automatically converted to the processes of step S101 to S104, and step S3 to S19 is same as the data updating process of FIGS. 7A and 7B.

[0175] S101: Read the restoration process segment number y and the overwrite processing segment number z from the nonvolatile memory.

[0176] S102: If the difference between the restoration process segment number and the overwrite processing segment number is 1, decide that the power supply was interrupted during the overwriting process and proceed to s104, or if the difference is 2, decide that the power supply was interrupted during the restoration process and proceed to s103.

[0177] S103: Suppose that x=y, and proceed to S3.

[0178] S104: Suppose that x=z+1, and proceed to S15.

[0179] S3: Describe the value x into the nonvolatile memory as the restoration process segment number.

[0180] S4: Read the difference data for the segment x from the nonvolatile memory.

[0181] S5: Read one (1) code from the transferred difference data.

[0182] S6: If the code read in S5 is “duplicated code”, proceed to S7, or is “updated code”, proceed to S8.

[0183] S7: From the reference position indicated by “duplicated code”, Output data of duplicated length indicated by “duplicated code” into the work memory, and proceed to S9.

[0184] S8: Output the updated data indicated by “updated code” into the work memory.

[0185] S9: Move the code reading position in the difference data backward for one (1) position.

[0186] S10: If the code reading position in the difference data is endmost of the difference data, proceed to S11, otherwise back to S5.

[0187] S11: Compare new data of the segment x restored on the work memory with old data of the segment x on the rewrite target memory, and if these are identical, proceed to S12, otherwise proceed to S13.

[0188] S12: Write into the nonvolatile memory the old and new identical code which indicates that old and new data of the segment x is identical, and proceed to S14.

[0189] S13: Store new data of the segment x restored on the work memory into the nonvolatile memory.

[0190] S14: Describe the value (X-1) into the nonvolatile memory as the overwrite processing segment number.

[0191] S15: Read the content of the nonvolatile memory which stores data of the segment (X-1), and if the old and new identical code is described, proceed to S17, otherwise proceed to S16.

[0192] S16: Overwrite new data of the segment (X-1) restored on the nonvolatile memory onto the segment (X-1) of old data stored in the internal memory.

[0193] S17: In order to make next segment into the reading target, increment x by 1.

[0194] S18: If restoration of all the segments is completed, proceed to S19, otherwise back to S3.

[0195] S19: Overwrite new data of the final segment restored on the nonvolatile memory onto the final segment of old data stored in the internal memory.

[0196] In this updating process resumed after the power supply is recovered, it will be possible to decide that whether the process resuming position after the power recovery is the restoration process or the overwriting process and to continue the data updating process, with the processes of step S101 to S104.

[0197]FIGS. 9A and 9B are block diagrams to which a second embodiment of the difference updating method of the invention is applied. This embodiment is characterized in that, in the difference data generating process on the base station 10 side, the data of constant size, for example 256KB, cut out from the new file 16 by the segment cut-out unit 18 is further divided into n block data by a block division unit 52 and it is arranged such that the difference data is generated from the process for each block.

[0198] Corresponding to the generation of the difference data on the base station 10 side, which corresponds to the block data wherein one (1) segment is divided into n blocks, also in the restoration processing unit 36 on the cell phone 12 side, for the restoration process by means of the difference data for each segment, it is arranged such that the restoration of new data is executed based on the difference block data which is divided into n pieces. It is noted that other structures are the same as the first embodiment in FIGS. 1A and 1B.

[0199]FIGS. 10A to 10C are flowcharts of the difference data generating process in the base station 10 of FIGS. 9A and 9B. It is noted that the size of one segment is assumed to be 256KB in this process.

[0200] S1: Read old file from a disk or the like.

[0201] S2: Read data which size is 256 KB from new file, and define as one (1) segment x (the xth segment).

[0202] S3: Set up a data comparison target pointer P at the head of the segment x, and a data reference pointer Q at the position corresponding to the head of the segment x.

[0203] S4: Compare a value indicated by the data comparison target pointer P and a value indicated by the data reference pointer Q.

[0204] S5: If values of S4 are identical, proceed to S8, otherwise proceed to S6.

[0205] S6: Search for matching part with the value indicated by the data comparison target pointer from endmost of the old file toward the position corresponding to the head of the segment (X-1).

[0206] S7: As a result of the search, if the matching data is found in the old file, proceed to S8. If not found, proceed to S11.

[0207] S8: Move the data comparison target pointer P and the data reference pointer Q from the position of each pointer backward in increments of one (1) byte, compare values thereof, and measure how many bytes matching of the values occurs for consecutively.

[0208] S9: When the values are no longer matching, output the value of the data reference pointer when the values matched for the first time and the matching length measured in S6 as “duplicated code” into the difference data.

[0209] S10: Move the data comparison target pointer P to the position of the last matching data for the data reference pointer Q, and proceed to S13.

[0210] S11: It is decided that this is the case that the matching data is not found in the old file and the value Indicated by the data comparison target is newly appeared data with the update.

[0211] S12: Output an “updated code” and a value thereof (updated data) into the difference data.

[0212] S13: Move the data comparison target pointer P one (1) byte backward.

[0213] S14: As a result of the movement of S13, if the pointer reaches to endmost of the segment x, proceed to S15, otherwise proceed to S4.

[0214] S15: Equally divide the segment x into n blocks.

[0215] S16: Compare the contents of old and new data in the m-th block, and if old and new data is identical, proceed to S17, otherwise proceed to S18.

[0216] S17: Add the old and new identical code, which indicates that the contents of the old and new m-th blocks are identical, to the difference data for the segment x.

[0217] S18: If the m-th block is the final block of the segment x, proceed to S20, otherwise proceed to S19.

[0218] S19: Increment the value of m by 1 and back to S16.

[0219] S20: If the segment x is the final segment of the new file, terminate the difference extracting process, otherwise proceed to S21.

[0220] S21: In order to make next segment into the reading target, increment x by 1 and back to S2.

[0221] In this difference data generating process, with steps S1 to S19, by comparing the block data wherein each segment is divided into n pieces with the block data of old file and adding the old and new identical code to the difference data if these are identical, it is possible to omit the process for comparing old data with new data restored by block unit in the updating process on the cell phone 12 side which is to be the embedded system and to reduce the time of the updating process correspondingly.

[0222]FIGS. 11A to 11C are flowcharts of the data updating process in the cell phone of FIGS. 9A and 9B. It is noted that the default value of x is assumed to be 1.

[0223] S1: transfer the difference data for all segments from outside and receive It.

[0224] S2: Store the received difference data into the nonvolatile memory.

[0225] S3: Describe the value x into the nonvolatile memory as the restoration process segment number.

[0226] S4: If the old and new identical code, which indicates that old and new block m is identical, is added to the difference data for the segment x, proceed to S5, otherwise proceed to S6.

[0227] S5: Write and store into the nonvolatile memory the old and new identical code which indicates that old and new block m of the segment x is identical, and proceed to S14.

[0228] S6: Read the difference data for the block m of the segment x from the nonvolatile memory.

[0229] S7: Read one (1) code from the transferred difference data.

[0230] S8: If the code read in S7 is “duplicated code”, proceed to S9, or is “updated code”, proceed to S10.

[0231] S9: From the reference position indicated by “duplicated code”, Output data of duplicated length indicated by “duplicated code” into the work memory, and proceed to S11.

[0232] S10: Output the updated data indicated by “updated code” into the work memory.

[0233] S11: Move the cod reading position in the difference data backward for one (1) position.

[0234] S12: If the code reading position in the difference data is endmost of the difference data of the block m, proceed to S13, otherwise back to S7.

[0235] S13: Store the data of the block m of the segment x restored on the work memory into the nonvolatile memory.

[0236] S14: Increment the value of m by 1.

[0237] S15: If the process is completed through the final block of the segment x, proceed to S16, otherwise back to S4.

[0238] S16: Describe the value (X-1) into the nonvolatile memory as the overwrite processing segment number.

[0239] S17: Read the content of the nonvolatile memory which stores data of the segment (X-1), and if the old and new identical code, which indicates that old and new data is identical for block m, is described, proceed to S19, otherwise proceed to S18.

[0240] S18: Overwrite new data of the block m of the segment (X-1) restored on the nonvolatile memory onto the block m of the segment (X-1) of old data stored in the internal memory.

[0241] S19: Increment th value of m by 1.

[0242] S20: If all the overwriting process is completed through the final block of the segment (X-1), proceed to S21, otherwise proceed to S17.

[0243] S21: In order to make next segment into the reading target, increment x by 1.

[0244] S22: If restoration of all the segments is completed, proceed to S23, otherwise back to S3.

[0245] S23: Overwrite new data of the final segment restored on the nonvolatile memory onto the final segment of old data stored in the internal memory.

[0246] In this data updating process in the cell phone 12, by storing the difference data of all the segments into the nonvolatile memory first with the processes of step S1 and S2, a problem that the difference data can never be received from outside because of the power interruption during the updating process is resolved.

[0247] Also, with the description of the restoration process segment number into the nonvolatile memory in step S3 and the description of the overwrite processing segment number into the nonvolatile memory in step S16, if the updating process is suspended by the power interruption, it is possible to resume the updating process from the segment in the middle after the power supply is recovered.

[0248] Further, with the writing of the block data of the segment restored in step S13 into the nonvolatile memory, a problem that the restored block data is lost by the power interruption is resolved. Also, by skipping the writing into the nonvolatile memory when the old and new identical code is present in step 4 as well as skipping the overwriting onto the write target data when the old and new identical code is described in step 17, increase of processing time with the overwriting process can be prevented.

[0249]FIGS. 12A to 12C are flowcharts in the case where the updating process is resumed from the middle after the power supply is recovered, when the power supply is interrupted during the data updating process in the cell phone 12 in FIGS. 9A and 9B. This process is the one in which processes of steps S1 and S2 in FIG. 8C are automatically converted to the processes of step S101 to S104, and step S3 to S23 is same as the data updating process of FIG. 8C.

[0250] S101: Read the restoration process segment number y and the overwrite processing segment number z from the nonvolatile memory.

[0251] S102: If the difference between the restoration process segment number y and the overwrite processing segment number z is 1, decide that the power supply was interrupted during the overwriting process and proceed to s104, or if the difference is 2, decide that th power supply was interrupted during the restoration process and proceed to s103.

[0252] S103: Proceed to S3 with x=y.

[0253] S104: Proceed to S17 with x=z+1.

[0254] S3: Describe the value x into the nonvolatile memory as the restoration process segment number.

[0255] S4: If the old and new identical code, which indicates that old and new block m is identical, is added to the difference data for the segment x, proceed to S5, otherwise proceed to S6.

[0256] S5: Write and store into the nonvolatile memory the old and new identical code which indicates that old and new block m of the segment x is identical, and proceed to S14.

[0257] S6: Read the difference data for the block m of the segment x from the nonvolatile memory.

[0258] S7: Read one (1) code from the transferred difference data.

[0259] S8: If the code read in S7 is “duplicated code”, proceed to S9, or is “updated code”, proceed to S10.

[0260] S9: From the reference position indicated by “duplicated code”, Output data of duplicated length indicated by “duplicated code” into the work memory, and proceed to S11.

[0261] S10: Output the updated data indicated by “updated code” into the work memory.

[0262] S11: Move the code reading position in the difference data backward for one (1) position.

[0263] S12: If the code reading position in the difference data is endmost of the difference data of the block m, proceed to S13, otherwise back to S7.

[0264] S13: Store the data of the block m of the segment x restored on the work memory into the nonvolatile memory.

[0265] S14: Increment the value of m by 1.

[0266] S15: If the process is completed through the final block of the segment x, proceed to S16, otherwise back to S4.

[0267] S16: Describe the value (X-1) into the nonvolatile memory as the overwrite processing segment number.

[0268] S17: Read the content of the nonvolatile memory which stores data of the segment (X-1), and if the old and new identical code, which indicates that old and new data is identical for block m, is described, proceed to S19, otherwise proceed to S18.

[0269] S18: Overwrite new data of the block m of the segment (X-1) restored on the nonvolatile memory onto the block m of the segment (X-1) of old data stored in the internal memory.

[0270] S19: Increment the value of m by 1.

[0271] S20: If all the overwriting process is completed through the final block of the segment (X-1), proceed to S21, otherwise proceed to S17.

[0272] S21: In order to make next segment into the reading target, increment x by 1.

[0273] S22: If restoration of all the segments is completed, proceed to S23, otherwise back to S3.

[0274] S23: Overwrite new data of the final segment restored on the nonvolatile memory onto the final segment of old data stored in the internal memory.

[0275] In this updating process after the power supply is recovered, it will be possible to decide that whether the process resuming position after the power recovery is the updating process or the overwriting process and to continue the data updating process, with the processes of step S101 to S104.

[0276]FIGS. 13A to 13C are flowcharts of other embodiment of the data updating process in the cell phone 12 of FIGS. 1A and 1B, and this embodiment is characterize in that when the data restoration process for one (1) segment is completed, it is divided into n blocks, then each block is compared whether old and new data is identical or not, and if data is identical, the old and new data identical code which indicates this will be stored into the nonvolatile memory in stead of the new block data. Here the default value of x is assumed to be 1.

[0277] S1: Have the difference data for all segments transferred from outside and receive it.

[0278] S2: Store the received difference data into the nonvolatile memory.

[0279] S3: Describe the value x into the nonvolatile memory as the restoration process segment number.

[0280] S4: Read the difference data for the segment x from the nonvolatile memory.

[0281] S5: Read one (1) code from the transferred difference data.

[0282] S6: If the code read in S5 is “duplicated code”, proceed to S7, or is “updated code”, proceed to S8.

[0283] S7: From the reference position indicated by “duplicated code”, Output data of duplicated length indicated by “duplicated code” into the work memory, and proceed to S9.

[0284] S8: Output the updated data indicated by “updated code” into the work memory.

[0285] S9: Move the code reading position in the difference data backward for one (1) position.

[0286] S10: If the code reading position in the difference data is endmost of the difference data, proceed to S11, otherwise back to S5.

[0287] S11: Equally divide the segment x into n blocks.

[0288] S12: Compare the contents of old and new data in the m-th block, and if old and new data is identical, proceed to S13, otherwise proceed to S14.

[0289] S13: Describe the old and new identical code, which indicates that the contents of the old and new m-th blocks are identical, to the segment x of the nonvolatile memory.

[0290] S14: Store the new data of the m-th block restored on the work memory into the nonvolatile memory.

[0291] S15: If the m-th block is the final block of the segment x, proceed to S17, otherwise proceed to S16.

[0292] S16: Increment the value of m by 1 and back to S12.

[0293] S17: Describe the value (X-1) into the nonvolatile memory as the overwrite processing segment number.

[0294] S18: Read the content of the nonvolatile memory which stores data of the segment (X-1), and if the old and new identical code, which indicates that old and new data is identical for block m, is described, proceed to S20, otherwise proceed to S19.

[0295] S19: Overwrite new data of the block m of the segment (X-1) restored on the nonvolatile memory onto the block m of the segment (X-1) of old data stored in the internal memory.

[0296] S20: Increment the value of m by 1.

[0297] S21: If all the overwriting process is completed through the final block of the segment (X-1), proceed to S22, otherwise proceed to S18.

[0298] S22: In order to make next segment into the reading target, increment x by 1.

[0299] S23: If restoration of all the segments is completed, proceed to S24, otherwise back to S3.

[0300] S24: Overwrite new data of the final segment restored on the nonvolatile memory onto the final segment of old data stored in the internal memory.

[0301]FIGS. 14A to 14C are flowcharts in the case where the updating process is resumed from the middle after the power supply is recovered, when the power supply is interrupted during the data updating process in FIGS. 13A to 13C. This process is the one in which processes of steps S1 and S2 in FIG. 13A are automatically converted to the processes of step S101 to S104, and step S3 to S23 is same as the data updating process of FIGS. 13A to 13C.

[0302] S101: Read the restoration process segment number y and the overwrite processing segment number z from the nonvolatile memory.

[0303] S102: If the difference between the restoration process segment number y and the overwrite processing segment number z is 1, decide that the power supply was interrupted during the overwriting process and proceed to s104, or if the difference is 2, decide that the power supply was Interrupted during the restoration process and proceed to s103.

[0304] S103: Suppose that x=y, and proceed to S3.

[0305] S104: Suppose that x=z+1, and proceed to S17.

[0306] S3: Describe the value x into the nonvolatile memory as the restoration process segment number.

[0307] S4: Read the difference data for the segment x from the nonvolatile memory.

[0308] S5: Read one (1) code from the transferred difference data.

[0309] S6: If the code read in S5 is “duplicated code”, proceed to S7, or is “updated code”, proceed to S8.

[0310] S7: From the reference position indicated by “duplicated code”, output data of duplicated length indicated by “duplicated code” into the work memory, and proceed to S9.

[0311] S8: Output the updated data indicated by “updated code” into the work memory.

[0312] S9: Move the code reading position in the difference data backward for one (1) position.

[0313] S10: If the code reading position in the difference data is endmost of the difference data, proceed to S11, otherwise back to S5.

[0314] S11: Equally divide the segment x into n blocks.

[0315] S12: Compare the contents of old and new data in the m-th block, and if old and new data is identical, proceed to S13, otherwise proceed to S14.

[0316] S13: Describe the old and new identical code, which indicates that the contents of the old and new m-th blocks are identical, to the segment x of the nonvolatile memory.

[0317] S14: Store the new data of the m-th block restored on the work memory into the nonvolatile memory.

[0318] S15: If the m-th block is the final block of the segment x, proceed to S17, otherwise proceed to S16.

[0319] S16: Increment the value of m by 1 and back to S12.

[0320] S17: Describe the value (X-1) into the nonvolatile memory as the overwrite processing segment number.

[0321] S18: Read the content of the nonvolatile memory which stores data of the segment (X-1), and if the old and new identical code, which indicates that old and new data is identical for block m, is described, proceed to S20, otherwise proceed to S19.

[0322] S19: Overwrite new data of the block m of the segment (X-1) restored on the nonvolatile memory onto the block m of the segment (X-1) of old data stored in the internal memory.

[0323] S20: Increment the value of m by 1.

[0324] S21: If all the overwriting process is completed through the final block of the segment (X-1), proceed to S22, otherwise proceed to S18.

[0325] S22: In order to make next segment into the reading target, increment x by 1.

[0326] S23: If restoration of all the segments is completed, proceed to S24, otherwise back to S3.

[0327] S24: Overwrite new data of the final segment restored on the nonvolatile memory onto the final segment of old data stored in the internal memory.

[0328] In the embodiments, though taken as an example is the case that difference data is generated in the base station and transferred to the cell phone which is the embedded system to execute the difference updating process, the invention is not limited to this and includes the case that difference data is transferred from any apparatus on the transmitting side to an apparatus equipped with the embedded system to execute the difference update of the data to be written.

[0329] Also, the present invention includes any variants without impairing the objects and advantages thereof and is not limited by the numerical values indicated in the embodiments.

[0330] As set forth hereinabove, according to the present invention, even if power supply is interrupted during an updating process from difference data of each segment, which is included in the processing procedure of the divided difference updating process on the embedded system of a cell phone, etc., it is possible to resume the updating process from that segment after power supply is recovered.

[0331] Also, at the time of power interruption during restoring data as well as at the time of power interruption during overwriting process onto old data, it is possible to decide the process suspended and continue from the process before interruption after power is recovered, and it is possible to resume the difference updating process without executing unnecessary restoration processes and overwriting processes.

[0332] Further, if new data restored from difference data of each segment is identical to old data which is the data to be written, the processing time will be reduced by making the writing of new data into the nonvolatile memory and the overwriting onto the memory which stores old data unnecessary, and by doing nothing and skipping the process when there is no need to execute the process. 

What is claimed is:
 1. A difference updating method comprising: a difference data reception step, with a difference data reception unit, receiving difference data of all the segments which is generated for each segment by dividing a new one of two old and new files into a plurality of segments of the same size and searching for a data row matching a data row in each segment within the range from the position which is one segment before the starting position of a target segment of the old file to the endmost of the old file and storing the received difference data into a nonvolatile memory; a restoration processing step, with a restoration processing unit, storing the restoration process segment number (X) indicative of a current process segment into the nonvolatile memory, thereafter restoring segment data from one segment of the difference data and storing the restored segment data into the nonvolatile memory; and an overwrite processing step, with an overwrite processing unit, storing the overwrite processing segment number (X-1) indicative of an immediately preceding process segment into the nonvolatile memory, thereafter reading from the nonvolatile memory the restored data which has been restored on the immediately preceding segment and overwriting the read restored data onto data to be rewritten in a nonvolatile memory.
 2. The difference updating method according to claim 1, wherein the difference data reception step includes receiving the difference data for each segment which is generated by searching for a data row matching a data row in each segment within the range from the starting position of a target segment of the old file to the endmost of the old file.
 3. The difference updating-method according to claim 1, further comprising: a decision step, with a decision unit, deciding whether the power supply is interrupted during the restoration process of the segment data or the power supply is interrupted during the overwriting process of the segment data, after the power supply is recovered in the case of power interruption; a restoration resume step, with a restoration resume unit, resuming the restoration process from the head of the segment of the restoration process segment number read from the nonvolatile memory after the power recovery in the case where the power supply has be n interrupted during the restoration process of the segment data; and an overwriting resume step, with an overwriting resume unit, resuming the overwriting process from the head of the overwrite processing segment number read from the nonvolatile memory after the power recovery in the case where the power supply has been interrupted during the overwriting process of the segment data.
 4. The difference updating method according to claim 3, wherein the decision step includes calculating a difference between the restoration process segment number and the overwrite processing segment number after the power supply is recovered in the case of the power interruption, deciding that the power supply was interrupted during the restoration process if the difference is 1, and deciding that the power supply was interrupted during the overwriting process if the difference is
 2. 5. The difference updating method according to claim 1, wherein the restoration processing step includes deciding whether the content of the restored segment data which is restored from one segment of the difference data and the content of the corresponding segment data of the data to be written are identical or not, and, if th se are identical, describing into the nonvolatile memory that the old and the new are identical, instead of the restored segment data; and wherein the overwrite processing step includes skipping the overwriting of the restored segment data if it is described in the nonvolatile memory that the old and the new are identical.
 6. The difference updating method according to claim 1, wherein the restoration processing step further includes equally dividing the restored segment data which is restored from one segment of the difference data into n pieces of restored block data, deciding whether the restored block data and the rewrite data are identical or not for each block, and, if these are identical, describing into the nonvolatile memory that the old and the new are identical, instead of the restored block data; and wherein the overwrite processing step includes skipping the overwriting of the restored block data if it is described in the nonvolatile memory that the old and the new are identical.
 7. A difference updating method comprising: a difference data reception step, with a difference data reception unit, generating difference data for each segment by dividing a new one of two old and new files into a plurality of segments of the same size and searching for a data row matching a data row in each segment within the range from the position which is one segment before the starting position of a target segment of the old file to the endmost of the old file, as well as equally dividing one segment of the old and new data into n blocks, deciding whether the block data of new file and the block data of old file are identical or not on a block-to-block basis, and, if these are identical, describing that the old and the new are identical into the difference data, instead of the difference block data, receiving the difference data of all the segments which has the description and storing the received difference data into a nonvolatile memory; a restoration processing step, with a restoration processing unit, storing the restoration process segment number (X) indicative of a current process segment into the nonvolatile memory, thereafter restoring the block data which is divided into n pieces per one segment of the difference data and storing the restored block data into the nonvolatile memory; and an overwrite processing step, with an overwrite processing unit, storing the overwrite processing segment number (X-1) indicative of an immediately preceding process segment into the nonvolatile memory, thereafter reading from the nonvolatile memory the restored block data which is divided into n pieces per restored data which is restored on the immediately preceding segment and overwriting the read restored block data onto the data to be written in the nonvolatile memory.
 8. The difference updating method according to claim 7, further comprising: a decision step, with a decision unit, deciding whether the power supply is interrupted during the restoration process of the segment data or the power supply is interrupted during the overwriting process of the segment data, after the power supply is recovered in the case of power interruption; a restoration resume step, with a restoration resume unit, resuming the restoration process from the head of the segment of the restoration process segment number read from the nonvolatile memory after the power recovery in the case where the power supply has been interrupted during the restoration process of the segment data; and an overwriting resume step, with an overwriting resume unit, resuming the overwriting process from the head of the overwrite processing segment number read from the nonvolatile memory after the power recovery in the case where the power supply has been interrupted during the overwriting process of the segment data.
 9. The difference updating method according to claim 7, wherein the restoration processing step includes skipping the restoration process based on the difference block data and describing in the nonvolatile memory that the old and the new are identical, if it is described in the difference block data that the old and the new are identical, and wherein the overwrite processing step includes skipping the overwriting of the restored block data, if it is described in the nonvolatile memory that the old and the new are identical.
 10. A program allowing a computer to execute: a difference data reception step receiving difference data of all the segments which is generated for each segment by dividing a new one of two old and new files into a plurality of segments of the same size and searching for a data row matching a data row in each segment within the range from the position which is one segment before the starting position of a target segment of the old file to the endmost of the old file and storing the received difference data into a nonvolatile memory; a restoration processing step storing the restoration process segment number (X) indicative of a current process segment into the nonvolatile memory, thereafter restoring segment data from one segment of the difference data and storing the restored segment data into the nonvolatile memory; and an overwrite processing step storing the overwrite processing segment number (X-1) indicative of an immediately preceding process segment into the nonvolatile memory, thereafter reading from the nonvolatile memory the restored data which has been restored on the immediately preceding segment and overwriting the read restored data onto data to be rewritten in the nonvolatile memory.
 11. The program according to claim 10, wherein the difference data reception step includes receiving the difference data for each segment which is generated by searching for a data row matching a data row in each segment within the rang from the starting position of a target segment of the old file to the endmost of the old file.
 12. The program according to claim 10, further comprising: a decision step deciding whether the power supply is interrupted during the restoration process of the segment data or the power supply is interrupted during the overwriting process of the segment data, after the power supply is recovered in the case of power interruption; a restoration resume step resuming the restoration process from the head of the segment of the restoration process segment number read from the nonvolatile memory after the power recovery in the case where the power supply has been interrupted during the restoration process of the segment data; and an overwriting resume step resuming the overwriting process from the head of the overwrite processing segment number read from the nonvolatile memory after the power recovery in the case where the power supply has been interrupted during the overwriting process of the segment data.
 13. The program according to claim 12, wherein the decision step includes calculating a difference between the restoration process segment number and the overwrite processing segment number after the power supply is recovered in the case of the power interruption, deciding that the power supply was interrupted during the restoration process if the difference is 1, and deciding that the power supply was interrupted during the overwriting process if the difference is
 2. 14. The program according to claim 10, wherein the restoration processing step includes deciding whether the content of the restored segment data which is restored from one segment of the difference data and the content of the corresponding segment data of the data to be written are identical or not, and, if these are identical, describing into the nonvolatile memory that the old and the new are identical, instead of the restored segment data; and wherein the overwrite processing step includes skipping the overwriting of the restored segment data if it is described in the nonvolatile memory that the old and the new are identical.
 15. The program according to claim 10, wherein the restoration processing step further includes equally dividing the restored segment data which is restored from one segment of the difference data into n pieces of restored block data, deciding whether the restored block data and the rewrite data are identical or not for each block, and, if these are identical, describing into the nonvolatile memory that the old and the new are identical, instead of the restored block data; and wherein the overwrite processing step includes skipping the overwriting of the restored block data if it is described in the nonvolatile memory that the old and the new are identical.
 16. A program allowing a computer to execute: a difference data reception step generating difference data for each segment by dividing a new one of two old and new files into a plurality of segments of the same size and searching for a data row matching a data row in each segment within the range from the position which is one segment before the starting position of a target segment of the old file to the endmost of the old file, as well as equally dividing one segment of the old and new data into n blocks, deciding whether the block data of new file and the block data of old file are identical or not on a block-to-block basis, and, if these are identical, describing that the old and the new are identical into the difference data, instead of th difference block data, receiving the difference data of all the segments which has the description and storing the received difference data into a nonvolatile memory; a restoration processing step storing the restoration process segment number (X) indicative of a current process segment into the nonvolatile memory, thereafter restoring the block data which is divided into n pieces per one segment of the difference data and storing the restored block data into the nonvolatile memory; and an overwrite processing step storing the overwrite processing segment number (X-1) indicative of an immediately preceding process segment into the nonvolatile memory, thereafter reading from the nonvolatile memory the restored block data which is divided into n pieces per restored data which is restored on the immediately preceding segment and overwriting the read restored block data onto the data to be written in the nonvolatile memory.
 17. The program according to claim 16, wherein the difference data reception step includes receiving the difference data for each segment which is generated by searching for a data row matching a data row in each segment within the range from the starting position of a target segment of the old file to the endmost of the old file.
 18. The program according to claim 16, further comprising: a decision step deciding whether the power supply is interrupted during the restoration process of the segment data or the power supply is interrupted during the overwriting process of the segment data, after the power supply is recovered in the case of power interruption; a restoration resume step resuming the restoration process from the head of the segment of the restoration process segment number read from the nonvolatile memory after the power recovery in the case where the power supply has been interrupted during the restoration process of the segment data; and an overwriting resume step resuming the overwriting process from the head of the overwrite processing segment number read from the nonvolatile memory after the power recovery in the case where the power supply has been interrupted during the overwriting process of the segment data.
 19. The program according to claim 18, wherein the decision step includes calculating a difference between the restoration process segment number and the overwrite processing segment number after the power supply is recovered in the case of the power interruption, deciding that the power supply was interrupted during the restoration process if the difference is 1, and deciding that the power supply was interrupted during the overwriting process if the difference is
 2. 20. The program according to claim 16, wherein the restoration resume step includes skipping the restoration process based on the difference block data and describing in the nonvolatile memory that the old and the new are identical, if it is described in the difference block data that the old and the new are identical, and wherein the overwrite processing step includes skipping the overwriting of the restored block data, if it is described in the nonvolatile memory that the old and the new are identical.
 21. A difference updating apparatus comprising: a difference data reception unit for receiving difference data of all the segments which is generated for each segment by dividing a new one of two old and new files into a plurality of segments of the same size and searching for a data row matching a data row in each segment within the range from the position which is one segment before the starting position of a target segment of the old file to the endmost of the old file and storing the received difference data into a nonvolatile memory; a restoration processing unit for storing the restoration process segment number (X) indicative of a current process segment into the nonvolatile memory, thereafter restoring segment data from one segment of the difference data and storing the restored segment data into the nonvolatile memory; an overwrite processing unit for storing the overwrite processing segment number (X-1) indicative of an immediately preceding process segment into the nonvolatile memory, thereafter reading from the nonvolatile memory the restored data which has been restored on the immediately preceding segment and overwriting the read restored data onto data to be rewritten in the nonvolatile memory; a decision unit for deciding whether the power supply is interrupted during the restoration process of the segment data or the power supply is interrupted during the overwriting process of the segment data, after the power supply is recovered in the case of power interruption; a restoration resume unit for resuming the restoration process from the head of the segment of the restoration process segment number read from the nonvolatile memory after the power recovery in the case where the power supply has been interrupted during the restoration process of the segment data; and an overwriting resume unit for resuming the overwriting process from the head of the overwrite processing segment number read from the nonvolatile memory after the power recovery in the case where the power supply has been interrupted during the overwriting process of the segment data.
 22. A difference updating apparatus comprising: a difference data reception unit for generating difference data for each segment by dividing a new one of two old and new files into a plurality of segments of the same size and searching for a data row matching a data row in each segment within the range from the position which is one segment before the starting position of a target segment of the old file to the endmost of the old file, as well as equally dividing one segment of the old and new data into n blocks, deciding whether the block data of new file and the block data of old file are identical or not on a block-to-block basis, and, if these are identical, describing that the old and the new are identical into the difference data, instead of the difference block data, receiving the difference data of all the segments which has the description and storing the received difference data into a nonvolatile memory; a restoration processing unit for storing the restoration process segment number (X) indicative of a current process segment into the nonvolatile memory, thereafter restoring the block data which is divided into n pieces per one segment of the difference data and storing the restored block data into the nonvolatile memory; an overwrite processing unit for storing the overwrite processing segment number (X-1) indicative of an immediately preceding process segment into the nonvolatile memory, thereafter reading from the nonvolatile memory the restored block data which is divided into n pieces per restored data which is restored on the immediately preceding segment and overwriting the read restored block data onto the data to be written in the nonvolatile memory; a decision unit for deciding whether the power supply is interrupted during the restoration process of the segment data or the power supply is interrupted during the overwriting process of the segment data, after the power supply is recovered in the case of power interruption; a restoration resume unit for resuming the restoration process from the head of the segment of the restoration process segment number read from the nonvolatile memory after the power recovery in the case where the power supply has been interrupted during the restoration process of the segment data; and an overwriting resume unit for resuming the overwriting process from the head of the overwrite processing segment number read from the nonvolatile memory after the power recovery in the case where the power supply has been interrupted during the overwriting process of the segment data. 